<?php
/**
 * Geneone: Content Management Framework
 * Change Password
 *
 * http://geneone.neondragon.net/
 *
 * @package Geneone
 * @author Khlo
 * @version 1.0
 * @copyright 2004-2006 Geneone Development Team
 */
 
class Gene_Special_Retype {
	/**
	 * Default Action
	 */
	function main() {
		$tpl =& Gene::getTemplate();
		$password = Gene_Request::getString("retypepassword", GENE_REQUEST_POST);
		
		if ($_SERVER['REQUEST_METHOD'] == 'POST' && $password) {
			$user =& Gene::getUser();
			
			if ($user->checkPassword($password)) {
				$auth =& Gene::getAuth();
				$auth->bumpPasswordRetype();
				
				$returnvars = Gene_Request::getArray("ret", GENE_REQUEST_POST);
				
				if ($returnvars && count($returnvars)) {
					$tpl->assign ("success", true);
					$tpl->assign ("returnurl", Gene::makeLink(Gene_Request::getString("r", GENE_REQUEST_POST)));
					$tpl->assign ("returnvars", $returnvars);
				} else {
					$return = Gene_Request::getString("r", GENE_REQUEST_POST);
					header ("Location: ".Gene::makeLink($return));
					exit();
				}
			} else {
				$tpl->assign ("errormsg", "Your password was not entered correctly. Passwords are case-sensitive.");
			}
		}

		$tpl->assign ("finalbody", $tpl->fetch("special/retype"));
	}
}
?>